<template>
	<view class="affiche">
		<u-collapse style="margin: 0rpx 30rpx 0;border-radius: 20rpx;overflow: hidden;" v-for="(item,index) in dataList" :key="index" :value="open">
			<u-collapse-item :icon='$imgUrl+item.img' style="overflow: hidden;background-color: #fff;border-radius: 20rpx;margin-bottom: 20rpx;" :title="item.title"
				:name="index">
				<view v-html="item.content"></view>
			</u-collapse-item>
		</u-collapse>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				flag: true,
				searchData: {
					page: 0,
				},
				dataList: [],
				open:[0],
			};
		},
		methods: {
			getList() {
				this.$httpRequest('/index/articleList', this.searchData).then(res => {
					if (res.data.last_page > res.data.current_page) {
						this.searchData.page++;
					} else {
						this.flag = false
					}
					this.dataList.push(...res.data.data)
				});
			},
			// 触底刷新
			onReachBottom() {
				if (this.flag) {
					this.getList();
				}
			},
			// 下拉刷新
			onPullDownRefresh() {
				this.searchData.page = 1;
				this.flag = true;
				this.dataList = [];
				this.getList();
				uni.stopPullDownRefresh();
			},
		},
		onLoad() {
			this.getList();
		}
	}
</script>

<style lang="less">
	.affiche {
		padding-top: 20rpx;
	}
</style>